$(document).ready(function(){
	
	var rootPath = getRootPath();
	
	$.ajax({
		method : 'get',
		url : rootPath+'/wechat/api/showroom/brands?brandCode=',
		error:function(XMLHttpRequest, ajaxOptions, thrownError){
			alert("连接服务器错误!");
		},
		success : function(resultData){
			
			var wholeHtml = '';
			$.each(resultData,function(brandIndex,brandObj){
				
				var brandHtml = '';
				
				var brandCode = brandObj.brandCode;
				
				brandHtml = brandHtml +'<div class="row" style="margin: 0px 10px 0px 10px;">'
				                      +'<ul class="pager">'
					                  +'    <span class="pull-left"><img src="../images/'+brandObj.brandName+'/logo/'+brandObj.brandName+'.png" width="35" height="35" class="img-responsive" alt="Generic placeholder thumbnail"></span>'
					                  +'    <h6 class="pull-left">'+brandObj.brandName+'</h6>'
					                  +'    <h6 class="pull-right">'+brandObj.onsellCount+'款在售</h6>'
				                      +'</ul>'
				                      +'</div>'
				                      +'<div class="row" style="background-color: #FFFFFF;margin: 0px 10px 0px 10px;padding: 10px 10px 10px 10px;">'
				
				$.each(brandObj.series,function(seriesIndex,seriesObj){	
					var localPriceMinTemp = seriesObj.localPriceMin;
					var localPriceMaxTemp = seriesObj.localPriceMax;
					var seriesCount =seriesObj.seriesCount;
					if(localPriceMinTemp==undefined || localPriceMinTemp==''){
						localPriceMinTemp='';
					}
					if(localPriceMaxTemp==undefined || localPriceMaxTemp==''){
						localPriceMaxTemp='';
					}
					if(seriesCount==undefined || seriesCount==''){
						seriesCount = '';
					}
					var seriesHtml = '<div class="col-xs-6 col-sm-3 placeholder">'
								    +    '<a href="newCarShowroom/modelExhibition.html?brandCode='+brandCode+'&seriesCode='+seriesObj.seriesCode+'">'
									+        '<img src="../images/'+brandObj.brandName+'/外观/'+seriesObj.seriesName+'/'+seriesObj.seriesName+'.jpg" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">'
									+        '<center><h5>'+seriesObj.seriesName+'</h5></center>'
									+        '<center><h6><span class="text-muted">('+localPriceMinTemp+'-'+localPriceMaxTemp+'万|'+seriesCount+'款)</span></h6></center>'
								    +    '</a>'
							        +'</div>';
					brandHtml = brandHtml + seriesHtml;
				});
				
				         
				brandHtml = brandHtml + '</div>';
				wholeHtml += brandHtml;
				
			});
			
			
			$("#seriesExhibitionDiv").append(wholeHtml);

		}
	});

	
});